﻿using System;
using System.Collections.Generic;
using System.Linq;
using Se.Framework.Common.ObjectRegistrySupport;

namespace Se.Framework.Common.Data
{
    public interface IBusinessLayer<T>
        where T : class
    {
        /// <summary>
        /// Gets all items
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetItems();

        /// <summary>
        /// Looks for item with the given id
        /// </summary>
        /// <returns>Item</returns>
        T Find(int id);

        /// <summary>
        /// Adds the given item to the collection
        /// </summary>
        /// <param name="item"></param>
        void AddItem(T item);

        /// <summary>
        /// Removes the given item from the collection
        /// </summary>
        /// <param name="item"></param>
        void DeleteItem(T item);

        /// <summary>
        /// Updates the given item
        /// </summary>
        /// <param name="item"></param>
        void UpdateItem(T item);


        TDto FindDto<TDto>(int id);

        IEnumerable<TDto> GetDtoItems<TDto>();
    }
}
